<?php

class admin_controller_system_app extends admin_controller
{

	public function listing()
	{
		$model_app = $this->get_admin_model();
		$apps = $model_app->get_apps();
		
		foreach($apps as $app)
		{
		    $app->db_info = $model_app->get_db_info($app->name);
		}

		$template = $this->get_admin_template();
        $template->set_title('应用管理');
		$template->set('apps', $apps);
		$template->display();
	}
	
	public function edit()
	{
	    $app = get('id', '0');
	    
	    $model_app = $this->get_admin_model();
	    
	    if($app=='0')
	    {
            $this->redirect('./?action=system.app.remote_listing');
	    }
	    else
	    {
    	    $obj = bone::get_app($app);
    	    $obj->db_info = $model_app->get_db_info($app);
    
    		$template = $this->get_admin_template();
            $template->set_title('应用详情');
    		$template->set( 'app', $obj );
    		
    		$template->display();
	    }
	}
	
	public function remote_listing()
	{
	    $model_app = $this->get_admin_model();
	    
        $remote_apps = $model_app->get_remote_apps();

        $template = $this->get_admin_template();
        $template->set_title('安装新应用');
        $template->set( 'remote_apps', $remote_apps );
		$template->display();
	}
	
	public function remote_detail()
	{
	
	}
}
?>